<?php


namespace app\api\service;


use app\api\service\impl\NormalOrderStrategy;
use app\model\order\Order;
use support\exception\BadException;

class OrderFactory
{
    static function getOrderStrategy($type): OrderStrategy
    {
        $order = [
            Order::TYPE_NORMAL => new NormalOrderStrategy()
        ];

        if (isset($order[$type])) {
            return $order[$type];
        }
        throw new BadException("未找到订单实现");
    }
}